/**
 * @author Mike
 * @date 2017/04/27
 * @desc 首页
 */

import React from 'react';
import { Icon } from 'antd';


import DataTable from '../../compontens/DataTable';

const columns = [{
  title: 'name',
  dataIndex: 'name',
  key: 'name',
  render: text => <a href="#">{text}</a>,
}, {
  title: 'Age',
  dataIndex: 'age',
  key: 'age',
}, {
  title: 'Address',
  dataIndex: 'address',
  key: 'address',
}, {
  title: 'Action',
  key: 'action',
  render: (text, record) => (
    <span>
      <a href="#">Action 一 {record.name}</a>
      <span className="ant-divider" />
      <a href="#">Delete</a>
      <span className="ant-divider" />
      <a href="#" className="ant-dropdown-link">
        More actions <Icon type="down" />
      </a>
    </span>
  ),
}];

export default class Home extends React.Component {
	
  constructor(porps) {
    super(porps);
  }

  componentDidMount () {
     const { fetchData } = this.props;
     fetchData();
  }

  render () {
    const { items } = this.props;
    const data = items;

    let _renderHtml;

    if (items.data != "") {
      _renderHtml = <DataTable columns={columns} data={data} />;
    } else {
      _renderHtml = "";
    }

    return ( 
      <div>
        { _renderHtml }
      </div>
    )
  }
}